/*
 * @Description: 海报
 * @Author: iamsmiling
 * @Date: 2021-06-11 08:47:08
 * @LastEditTime: 2021-06-11 10:19:08
 */
import 'package:carousel_slider/carousel_slider.dart';
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/local/poster_share/poster_share_entity.dart';
import 'package:get/get.dart';

class PosterController extends GetxController {
  List<PosterShareEntity> shareOptions = [
    PosterShareEntity(icon: R.image.wechatShare, label: "微信"),
    PosterShareEntity(icon: R.image.wechatMomentShare, label: "朋友圈"),
    PosterShareEntity(icon: R.image.qqShare, label: "QQ"),
    PosterShareEntity(icon: R.image.saveImage, label: "保存图片")
  ];
  late CarouselController controller;

  int currentIndex = 0;

  void jumpTo(int i) {
    currentIndex = i;
    controller.animateToPage(i);
    update();
  }

  void onPageChanged(int index, CarouselPageChangedReason reason) {
    currentIndex = index;
    update();
  }

  @override
  void onInit() {
    controller = CarouselController();
    super.onInit();
  }
}
